<html>
  <head>
	<title>Lightwave - OT Test</title>
	<script type="text/javascript" src="../scripts/ot.js"></script>
  </head>
  <body>
	<script type="text/javascript">

function runtest()
{
  // text1 := {"_rev":0, "_data":{"$object":true, "abc":"xyz", "num": 123, "foo":{"$object":true, "a":1,"b":3}, "arr":{"$array":[1,2,3]}}};
  // text2 := {"_rev":0, "_data":{"$object":true, "torben":"weis", "num": 321, "foo":{"$object":true, "a":6,"c":33}, "arr":{"$array":[4,5,6]}}};
  
  var doc = {"_rev":0, "_data":{}, "_meta":{}};
  var mut0 = {"_rev":0, "_data":{"$object":true, "foo":"bar"}};
  var mut1 = {"_rev":1, "_data":{"$object":true, "hoo":"goo", "arr":[1,2,3]}};
  var mut2 = {"_rev":2, "_data":{"$object":true, "foo":{"$text":["furcht", {"$skip":3}]}}};
  var mut3 = {"_rev":3, "_data":{"$object":true, "arr":{"$array":[{"$skip":1},200,{"$delete":1},400]}}};
  
  LW.JsonOT.applyDocMutation(doc, mut0, 0);
  console.log(JSON.stringify(doc));
  LW.JsonOT.applyDocMutation(doc, mut1, 0);
  console.log(JSON.stringify(doc));
  LW.JsonOT.applyDocMutation(doc, mut2, 0);
  console.log(JSON.stringify(doc));
  LW.JsonOT.applyDocMutation(doc, mut3, 0);
  console.log(JSON.stringify(doc));
}
</script>
	<h1>Lightwave - OT Test</h1>
	<input type="button" value="Run" onclick="runtest()" />
	<p id="result">...</p>
  </body>
</html>